var a = getApp();

Page({
    data: {
        page: 1,
        isLoadMore: !0,
        total_page: 0,
        listData: [],
        basics: {}
    },
    onLoad: function(a) {
        this.getListData();
    },
    onReady: function() {},
    toDetailsInfo: function(a) {
        var t = a.currentTarget.dataset.id || a.target.dataset.id;
        wx.navigateTo({
            url: "/packageH/superior_payment/superiorPaymentDetails/superiorPaymentDetails?id=" + t
        });
    },
    getListData: function() {
        var t = this, e = a.getNetAddresss("plugin.parent-payment.frontend.modules.payment.controllers.records.index");
        a._postNetWork({
            url: e,
            success: function(e) {
                var s = e.data;
                if (1 != s.result) return a.tips(s.msg);
                t.data.total_page = s.data.page_list.last_page, t.data.total_page || (t.data.total_page = 0), 
                t.setData({
                    basics: s.data.basics,
                    listData: s.data.page_list.data
                }), wx.setNavigationBarTitle({
                    title: s.data.basics.plugin_name || "上级代付"
                });
            }
        });
    },
    _getMoreData: function() {
        var t = this;
        if (this.data.isLoadMore = !1, !(this.data.page >= this.data.total_page)) {
            this.data.page += 1;
            var e = a.getNetAddresss("plugin.parent-payment.frontend.modules.payment.controllers.records.index"), s = {
                page: this.data.page
            };
            a._postNetWork({
                url: e,
                data: s,
                success: function(a) {
                    var e = a.data;
                    if (t.data.isLoadMore = !0, 1 === e.result) {
                        var s = t.data.listData.concat(e.data.page_list.data);
                        t.setData({
                            listData: s
                        });
                    } else t.data.page = t.data.page - 1, t.data.isLoadMore = !1;
                }
            });
        }
    },
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {
        this.data.isLoadMore ? this._getMoreData() : console.log("没有更多数据");
    },
    onShareAppMessage: function() {}
});